package com.example.chen.tabindicatorlib.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.chen.tabindicatorlib.R;

/**
 * Created by chen on 2016/6/29.
 */
public class VpSimpleFragment extends Fragment {

    private String mTitle;

    private static final String BUDDLE="title";

    public static VpSimpleFragment newInstance(String title){
        Bundle bundle = new Bundle();
        bundle.putString(BUDDLE, title);
        VpSimpleFragment fragment = new VpSimpleFragment();
        fragment.setArguments(bundle);
        return fragment;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        Bundle bundle = getArguments();
        if(bundle!=null){
            mTitle = bundle.getString(BUDDLE);
        }
        View view = LayoutInflater.from(getActivity()).inflate(R.layout.fragment, null);
        ((TextView)view.findViewById(R.id.id_content)).setText(mTitle);
        return view;

    }
}
